class Particle extends GameObject
{
  int rad;
  color particleColor;
  
  Particle(int xin, int yin, int massin, color colorin, PVector vin)
  {
    super(xin, yin, massin, vin);
    particleColor = colorin;
    rad = 3;  
  }
  
  Particle(int xin, int yin, int massin, color colorin)
  {
    super(xin, yin, massin, new PVector(random(-6,6),random(-6,6),random(-6,6)));
    particleColor = colorin;
    rad = 3;
  }
  

  
  void draw(Camera c)
  {
    
    if( ((position.x + rad) > (c.position.x - (width/2))) && ((position.x - rad) < (c.position.x + (width/2))) && ((position.y + rad) > (c.position.y - (height/2))) && ((position.y - rad)< (c.position.y + (height/2))))
    {
      fill(particleColor);
      stroke(particleColor);
      ellipse(position.x + (width/2 - c.position.x), position.y + (height/2 - c.position.y), rad, rad);
    }
  }
  
  void checkCollisions()
  {
    for(int i = 0; i < planetCount; i++)
    {
      Planet planet = (Planet)planets.get(i);
      float distance = sqrt(sq(planet.position.x - position.x) + sq(planet.position.y - position.y));
      if(distance <= planet.rad)
      {
        alive = false;
        drawn = false;
      }
    }
  }
 
  
  void applyPlanetGravity()
  {
    super.applyPlanetGravity();//try changing this to applyPlanetGravity(planetAlpha);
  }
  
  void update()
  {
    updatePosition();
    applyPlanetGravity();
    applyPlayerGravity(player);
    checkCollisions();
  }
}
